\(\int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx\) [782]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 73 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=\frac {2 \sec ^3(c+d x)}{3 a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}+\frac {\tan ^3(c+d x)}{3 a^2 d}+\frac {2 \tan ^5(c+d x)}{5 a^2 d} \]

[Out]

2/3*sec(d*x+c)^3/a^2/d-2/5*sec(d*x+c)^5/a^2/d+1/3*tan(d*x+c)^3/a^2/d+2/5*tan(d*x+c)^5/a^2/d

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {2790, 2687, 14, 2686, 30} \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=\frac {2 \tan ^5(c+d x)}{5 a^2 d}+\frac {\tan ^3(c+d x)}{3 a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}+\frac {2 \sec ^3(c+d x)}{3 a^2 d} \]

[In]

Int[Tan[c + d*x]^2/(a + a*Sin[c + d*x])^2,x]

[Out]

(2*Sec[c + d*x]^3)/(3*a^2*d) - (2*Sec[c + d*x]^5)/(5*a^2*d) + Tan[c + d*x]^3/(3*a^2*d) + (2*Tan[c + d*x]^5)/(5
*a^2*d)

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 2790

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Dist[a^(2*
m), Int[ExpandIntegrand[(g*Tan[e + f*x])^p/Sec[e + f*x]^m, (a*Sec[e + f*x] - b*Tan[e + f*x])^(-m), x], x], x]
/; FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && ILtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\int \left (a^2 \sec ^4(c+d x) \tan ^2(c+d x)-2 a^2 \sec ^3(c+d x) \tan ^3(c+d x)+a^2 \sec ^2(c+d x) \tan ^4(c+d x)\right ) \, dx}{a^4} \\ & = \frac {\int \sec ^4(c+d x) \tan ^2(c+d x) \, dx}{a^2}+\frac {\int \sec ^2(c+d x) \tan ^4(c+d x) \, dx}{a^2}-\frac {2 \int \sec ^3(c+d x) \tan ^3(c+d x) \, dx}{a^2} \\ & = \frac {\text {Subst}\left (\int x^4 \, dx,x,\tan (c+d x)\right )}{a^2 d}+\frac {\text {Subst}\left (\int x^2 \left (1+x^2\right ) \, dx,x,\tan (c+d x)\right )}{a^2 d}-\frac {2 \text {Subst}\left (\int x^2 \left (-1+x^2\right ) \, dx,x,\sec (c+d x)\right )}{a^2 d} \\ & = \frac {\tan ^5(c+d x)}{5 a^2 d}+\frac {\text {Subst}\left (\int \left (x^2+x^4\right ) \, dx,x,\tan (c+d x)\right )}{a^2 d}-\frac {2 \text {Subst}\left (\int \left (-x^2+x^4\right ) \, dx,x,\sec (c+d x)\right )}{a^2 d} \\ & = \frac {2 \sec ^3(c+d x)}{3 a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}+\frac {\tan ^3(c+d x)}{3 a^2 d}+\frac {2 \tan ^5(c+d x)}{5 a^2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.50 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.18 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=-\frac {\sec (c+d x) \left (-20+\frac {55}{4} \cos (c+d x)+4 \cos (2 (c+d x))-\frac {11}{4} \cos (3 (c+d x))-35 \sin (c+d x)+11 \sin (2 (c+d x))+\sin (3 (c+d x))\right )}{60 a^2 d (1+\sin (c+d x))^2} \]

[In]

Integrate[Tan[c + d*x]^2/(a + a*Sin[c + d*x])^2,x]

[Out]

-1/60*(Sec[c + d*x]*(-20 + (55*Cos[c + d*x])/4 + 4*Cos[2*(c + d*x)] - (11*Cos[3*(c + d*x)])/4 - 35*Sin[c + d*x
] + 11*Sin[2*(c + d*x)] + Sin[3*(c + d*x)]))/(a^2*d*(1 + Sin[c + d*x])^2)

Maple [A] (verified)

Time = 0.29 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.01

method result size
parallelrisch \(\frac {-\frac {8}{15}-\frac {8 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}-\frac {8 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}-\frac {32 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{15}}{d \,a^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}\) \(74\)
risch \(\frac {2 i \left (20 i {\mathrm e}^{3 i \left (d x +c \right )}+15 \,{\mathrm e}^{4 i \left (d x +c \right )}-4 i {\mathrm e}^{i \left (d x +c \right )}-20 \,{\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{15 \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )^{5} d \,a^{2}}\) \(86\)
norman \(\frac {-\frac {8 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}-\frac {8}{15 a d}-\frac {32 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{15 d a}-\frac {8 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}}{a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}\) \(95\)
derivativedivides \(\frac {-\frac {1}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {4}{5 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}+\frac {2}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {5}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {8}{32 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+32}}{d \,a^{2}}\) \(100\)
default \(\frac {-\frac {1}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {4}{5 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}+\frac {2}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {5}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {8}{32 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+32}}{d \,a^{2}}\) \(100\)

[In]

int(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

8/15*(-1-5*tan(1/2*d*x+1/2*c)^3-5*tan(1/2*d*x+1/2*c)^2-4*tan(1/2*d*x+1/2*c))/d/a^2/(tan(1/2*d*x+1/2*c)-1)/(tan
(1/2*d*x+1/2*c)+1)^5

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.05 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=\frac {2 \, \cos \left (d x + c\right )^{2} + {\left (\cos \left (d x + c\right )^{2} - 9\right )} \sin \left (d x + c\right ) - 6}{15 \, {\left (a^{2} d \cos \left (d x + c\right )^{3} - 2 \, a^{2} d \cos \left (d x + c\right ) \sin \left (d x + c\right ) - 2 \, a^{2} d \cos \left (d x + c\right )\right )}} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

1/15*(2*cos(d*x + c)^2 + (cos(d*x + c)^2 - 9)*sin(d*x + c) - 6)/(a^2*d*cos(d*x + c)^3 - 2*a^2*d*cos(d*x + c)*s
in(d*x + c) - 2*a^2*d*cos(d*x + c))

Sympy [F]

\[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=\frac {\int \frac {\sin ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\sin ^{2}{\left (c + d x \right )} + 2 \sin {\left (c + d x \right )} + 1}\, dx}{a^{2}} \]

[In]

integrate(sec(d*x+c)**2*sin(d*x+c)**2/(a+a*sin(d*x+c))**2,x)

[Out]

Integral(sin(c + d*x)**2*sec(c + d*x)**2/(sin(c + d*x)**2 + 2*sin(c + d*x) + 1), x)/a**2

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 184 vs. \(2 (65) = 130\).

Time = 0.22 (sec) , antiderivative size = 184, normalized size of antiderivative = 2.52 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=\frac {8 \, {\left (\frac {4 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {5 \, \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {5 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + 1\right )}}{15 \, {\left (a^{2} + \frac {4 \, a^{2} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {5 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} - \frac {5 \, a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} - \frac {4 \, a^{2} \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}} - \frac {a^{2} \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}}\right )} d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

8/15*(4*sin(d*x + c)/(cos(d*x + c) + 1) + 5*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + 5*sin(d*x + c)^3/(cos(d*x +
c) + 1)^3 + 1)/((a^2 + 4*a^2*sin(d*x + c)/(cos(d*x + c) + 1) + 5*a^2*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 - 5*a
^2*sin(d*x + c)^4/(cos(d*x + c) + 1)^4 - 4*a^2*sin(d*x + c)^5/(cos(d*x + c) + 1)^5 - a^2*sin(d*x + c)^6/(cos(d
*x + c) + 1)^6)*d)

Giac [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.29 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=-\frac {\frac {15}{a^{2} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}} - \frac {15 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 90 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 80 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 70 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 17}{a^{2} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}^{5}}}{60 \, d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

-1/60*(15/(a^2*(tan(1/2*d*x + 1/2*c) - 1)) - (15*tan(1/2*d*x + 1/2*c)^4 + 90*tan(1/2*d*x + 1/2*c)^3 + 80*tan(1
/2*d*x + 1/2*c)^2 + 70*tan(1/2*d*x + 1/2*c) + 17)/(a^2*(tan(1/2*d*x + 1/2*c) + 1)^5))/d

Mupad [B] (verification not implemented)

Time = 10.90 (sec) , antiderivative size = 132, normalized size of antiderivative = 1.81 \[ \int \frac {\tan ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx=\frac {8\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left ({\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+4\,{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+5\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+5\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}{15\,a^2\,d\,\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,{\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}^5} \]

[In]

int(sin(c + d*x)^2/(cos(c + d*x)^2*(a + a*sin(c + d*x))^2),x)

[Out]

(8*cos(c/2 + (d*x)/2)^3*(cos(c/2 + (d*x)/2)^3 + 5*sin(c/2 + (d*x)/2)^3 + 5*cos(c/2 + (d*x)/2)*sin(c/2 + (d*x)/
2)^2 + 4*cos(c/2 + (d*x)/2)^2*sin(c/2 + (d*x)/2)))/(15*a^2*d*(cos(c/2 + (d*x)/2) - sin(c/2 + (d*x)/2))*(cos(c/
2 + (d*x)/2) + sin(c/2 + (d*x)/2))^5)